/*
 *  DefaultSessionDataObserver.java
 * 
 *  Created on May 24, 2008, 1:44:26 PM
 */
package pl.edu.agh.ssm.monitor.data;

import java.util.LinkedList;
import java.util.List;
import pl.edu.agh.ssm.monitor.plotter.DataPlotter;

/**
 *
 * @author aneezka
 */
public class DefaultSessionDataObserver<T extends SessionData> implements SessionDataObserver<T> {

    public void fireDataAdded(T data) {
        for (DataPlotter<T> plotter : plotters) {
            plotter.plotNew(data);
        }
    }

    public void fireDataUpdated(T data) {
        for (DataPlotter<T> plotter : plotters) {
            plotter.plotUpdated(data);
        }
    }

    public void fireDataRemoved(T data) {
        for (DataPlotter<T> plotter : plotters) {
            plotter.plotRemoved(data);
        }
    }

    public void addPlotter(DataPlotter<T> plotter) {
        plotters.add(plotter);
    }
    
    private List<DataPlotter<T>> plotters = new LinkedList<DataPlotter<T>>();
}
